package de.slothsoft.commons.swing.validation;

import java.awt.Color;

import javax.swing.JComponent;

public final class ValidationUtil {

	public static void style(JComponent source, boolean valid, String errorMessage) {
		source.setToolTipText(valid ? null : errorMessage);
		if (valid) {
			source.setBackground(null);
		} else {
			source.setBackground(Color.RED);
		}
	}

	private ValidationUtil() {
		// *hide*
	}
}
